package com.wuliupai.delivery.wuliupaidelivery.utils;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * Activity活动收集器 用于退出登录
 */

public class ActivityCollector {

    public static List<Activity> activities = new ArrayList<Activity>();

    public static void addActivity(Activity activity) {
        activities.add(activity);
    }

    public static void removeActivity(Activity activity) {
        activities.remove(activity);
    }

    public static void finishAll() {
        for (Activity activity : activities) {
            if (!activity.isFinishing()) {
               /* String contextString = activity.toString();
                String substring = contextString.substring(contextString.lastIndexOf(".") + 1, contextString.indexOf("@"));
                LogUtils.log("界面集合:" +substring);*/
                activity.finish();
            }
        }
    }

}
